package com.zrrd.stackandqueue;

import java.util.Arrays;
import java.util.Stack;

public class Reserve {
    public void reseve(int[] array) {
        Stack<Integer> stack = new Stack<>();
        for (int i = 0; i < array.length; i++) {
            stack.push(array[i]);
        }
        for (int i = 0; i < array.length; i++) {
            array[i] = stack.pop();
        }
    }

    public static void main(String[] args) {
        Reserve reserve = new Reserve();
        int[] array = new int[]{0, 1, 2, 3, 4, 5, 6};
        reserve.reseve(array);
        System.out.println(Arrays.toString(array));
    }
}
